package com.sugon.service.impl;

import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.SpecUserRecordDao;
import com.sugon.entity.SpecUserRecordEntity;
import com.sugon.service.SpecUserRecordService;
import com.sugon.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 特殊人员资质复审记录Service实现类
 *
 * @author sugon
 * @date 2019-08-01 10:22:15
 */
@Service("specUserRecordService")
public class SpecUserRecordServiceImpl implements SpecUserRecordService {
    @Autowired
    private SpecUserRecordDao specUserRecordDao;

    @Override
    public SpecUserRecordEntity queryObject(String id) {
        return specUserRecordDao.queryObject(id);
    }

    @Override
    public List<SpecUserRecordEntity> queryList(Map<String, Object> map) {
        return specUserRecordDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return specUserRecordDao.queryTotal(map);
    }

    @Override
    public int save(SpecUserRecordEntity specUserRecord) {
        specUserRecord.setId(RandomUtil.randomString(32));
        specUserRecord.setCheckDate(new Date());
        specUserRecord.setCheckUser(ShiroUtils.getUserId());
        specUserRecord.setDelFlag(1);
        specUserRecord.setCreateUser(ShiroUtils.getUserId());
        specUserRecord.setCreateDate(new Date());
        return specUserRecordDao.save(specUserRecord);
    }

    @Override
    public int update(SpecUserRecordEntity specUserRecord) {
        return specUserRecordDao.update(specUserRecord);
    }

    @Override
    public int delete(String id) {
        return specUserRecordDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return specUserRecordDao.deleteBatch(ids);
    }
}
